package calculadora;

public class RenglonDevengado {

    private String[] renglones;
    private double acud;
    private double acuv;
    private double acua;
    private double total;

    public RenglonDevengado() {
        this.renglones = new String[5];
        this.acud = 0;
        this.acuv = 0;
        this.acua = 0;
    }

    public double getAcua() {
        return this.acua;
    }

    public double getAcud() {
        return this.acud;
    }

    public double getAcuv() {
        return this.acuv;
    }

    public void insertaDevengado(int tipo, double valor) {
        int columna = 0;
        if (tipo == 1) {
            columna = 4;
            this.acuv += valor;
        } else if (tipo == 0) {
            columna = 3;
            this.acud += valor;
        } else if (tipo == 2) {
            columna = 2;
            this.acua += valor;
        }
        if (tipo != -1) {
            if (this.renglones[columna] == null) {
                this.renglones[columna] = String.valueOf(valor);
            } else {
                this.renglones[columna] = String.valueOf(valor + Double.parseDouble(this.renglones[columna]));
            }
        }
    }

    public void inserta(int indice, String valor) {
        this.renglones[indice] = valor;
    }

    public void inserta(int indice, double valor) {
        if (this.renglones[indice] != null) {
            this.renglones[indice] = String.valueOf(valor + Double.parseDouble(this.renglones[indice]));
        } else {
            this.renglones[indice] = String.valueOf(valor);
        }
    }

    public String[] getRenglones() {
        return renglones;
    }
}
